<!-- Bootstrap 3.3.2 -->
<link href="/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<!-- Font Awesome Icons -->
<link href="/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<!-- Ionicons -->
<link href="/plugins/ionicons/css/ionicons.min.css" rel="stylesheet" type="text/css" />
<!-- DATA TABLES -->
<link href="/plugins/datatables/dataTables.bootstrap.css" rel="stylesheet" type="text/css" />
<!-- Morris chart -->
<link href="/plugins/morris/morris.css" rel="stylesheet" type="text/css" />
<!-- iCheck for checkboxes and radio inputs -->
<link href="/plugins/iCheck/all.css" rel="stylesheet" type="text/css" />
<!-- Daterange picker -->
<link href="/plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
<!-- Bootstrap time Picker -->
<link href="/plugins/timepicker/bootstrap-timepicker.min.css" rel="stylesheet"/>
<link href="/plugins/bootstrap-combobox/css/bootstrap-combobox.css" rel="stylesheet"/>
<!-- CSS to style the file input field as button and adjust the Bootstrap progress bars -->
<link rel="stylesheet" href="/plugins/bootstrap-upload/css/jquery.fileupload.css">
<link rel="stylesheet" href="/plugins/bootstrap-upload/css/jquery.fileupload-ui.css">
<!-- Theme style -->
<link href="/dist/css/AdminLTE.css" rel="stylesheet" type="text/css" />
<!-- AdminLTE Skins. Choose a skin from the css/skins
     folder instead of downloading all of them to reduce the load. -->
<link href="/dist/css/skins/_all-skins.min.css" rel="stylesheet" type="text/css" />

<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="/plugins/html5shiv.js"></script>
<script src="/plugins/respond.min.js"></script>
<![endif]-->

<!-- jQuery 2.1.3 -->
<script src="/plugins/jQuery/jQuery-2.1.3.min.js"></script>
<!-- iCheck -->
<script src="/plugins/iCheck/icheck.min.js" type="text/javascript"></script>

<!-- Bootstrap 3.3.2 JS -->
<script src="/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<!-- DATA TABES SCRIPT -->
<script src="/plugins/datatables/1.10.6/jquery.dataTables.min.js" type="text/javascript"></script>
<script src="/plugins/datatables/dataTables.bootstrap.js" type="text/javascript"></script>
<!-- FastClick -->
<script src='/plugins/fastclick/fastclick.min.js'></script>
<!-- Sparkline -->
<script src="/plugins/sparkline/jquery.sparkline.min.js" type="text/javascript"></script>
<!-- daterangepicker -->
<script src="/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
<!-- datepicker -->
<script src="/plugins/datepicker/bootstrap-datepicker.js" type="text/javascript"></script>
<script src="/plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js" type="text/javascript"></script>
<script src="/plugins/datetimepicker/bootstrap-datetimepicker.js" type="text/javascript"></script>
<!-- bootstrap time picker -->
<script src="/plugins/timepicker/bootstrap-timepicker.min.js" type="text/javascript"></script>

<!-- SlimScroll 1.3.0 -->
<script src="/plugins/slimScroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<!-- ChartJS 1.0.1 -->
<script src="/plugins/chartjs/Chart.min.js" type="text/javascript"></script>
<!-- CK Editor -->
<script src="/plugins/ckeditor/ckeditor.js"></script>
<script src="/plugins/ckeditor/lang/zh-cn.js"></script>
<!-- The jQuery UI widget factory, can be omitted if jQuery UI is already included -->
<script src="/plugins/bootstrap-upload/js/vendor/jquery.ui.widget.js"></script>
<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
<script src="/plugins/bootstrap-upload/js/jquery.iframe-transport.js"></script>
<!-- The basic File Upload plugin -->
<script src="/plugins/bootstrap-upload/js/jquery.fileupload.js"></script>

<script src="/plugins/bootbox.js"></script>
<script src="/plugins/jqBootstrapValidation.js"></script>
<!--复制JS插件-->
<script src="/plugins/ZeroClipboard.js"></script>
<!--bootstrap-combobox-->
<script src="/plugins/bootstrap-combobox/js/bootstrap-combobox.js"></script>

<script src="/dist/js/cookie.js" type="text/javascript"></script>
<!-- AdminLTE App -->
<script src="/dist/js/app.js" type="text/javascript"></script>

<script>
    bootbox.setLocale("zh_CN");
    $(function () {
        var jscript = '<%= jscript%>';
        console.log("加载的脚本",jscript)
        if(jscript){
            $.getScript('<%= jscript%>');
        }

        var activeMenu = '<%=active%>';
        if(activeMenu){
            $(".<%=active%>").addClass("active");
            $(".<%=active%>").parent().parent().addClass("active");
        }

        var username = getCookie("username");
        if(username){
            $(".username").text(username);
        }
        var createdDate = getCookie("create_time");
        if(createdDate){
            $(".createdDate").text(createdDate.substring(0,10));
        }

        var portrait = getCookie("portrait");
        if(portrait){
            $(".userImg").attr("src",portrait);
        }

        $(".head-img").click(function(){
            location.href = "/pam/profile";
        });

        $("#modPwdBtn").click(function(){
            bootbox.dialog({
                        title: "修改密码",
                        size:'small',
                        message: '<div class="row" >  ' +
                        '<div class="col-md-10" style="padding-left:18%;"> ' +
                        '<form class="form-horizontal"> ' +
                        '<div class="form-group"> ' +
                        '<label class="control-label" for="oldpwd">旧密码</label> ' +
                        '<input id="oldpwd" name="oldpwd" type="password" placeholder="旧密码" class="form-control"> ' +
                        '</div> ' +
                        '<div class="form-group"> ' +
                        '<label class="control-label" for="newpwd">新密码</label> ' +
                        '<input id="newpwd" name="newpwd" type="password" placeholder="新密码" class="form-control"> ' +
                        '</div> ' +
                        '<div class="form-group"> ' +
                        '<label class="control-label" for="renewpwd">重复新密码</label> ' +
                        '<input id="renewpwd" name="renewpwd" type="password" placeholder="重复新密码" class="form-control"> ' +
                        '</div> ' +
                        '</form> </div>  </div>',
                        buttons: {
                            success: {
                                label: "保存",
                                className: "btn-primary",
                                callback: function (result) {
                                    var oldpwd = $("#oldpwd").val();
                                    var newpwd = $("#newpwd").val();
                                    var renewpwd = $("#renewpwd").val();

                                    if(!oldpwd || !newpwd || !renewpwd){
                                        bootbox.alert("密码不能为空");
                                        return;
                                    }

                                    if(newpwd != renewpwd){
                                        bootbox.alert("重复新密码不匹配！");
                                        return;
                                    }

                                    $.ajax({
                                        url:"/doEditPwd",
                                        type:"post",
                                        data: {password:newpwd,oldpassword:oldpwd} ,
                                        dataType:'json',
                                        success: function(d){
                                            bootbox.alert(d.msg);
                                        },
                                        error: function(x, t, e) {}
                                    });//提交完成



                                }
                            }
                        }
                    }
            );
        });

        $('input').iCheck({
            checkboxClass: 'icheckbox_square-blue',
            radioClass: 'iradio_square-blue',
            increaseArea: '20%' // optional
        });

    });
</script>
</body>
</html>